package cn.itsource.basic.controller;

import cn.itsource.basic.dto.LoginDto;
import cn.itsource.basic.util.AjaxResult;
import cn.itsource.user.service.ILogininfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 登录
 */
@RestController
public class LoginController {
    @Autowired
    private ILogininfoService logininfoService;

    @PostMapping("/login")
    public AjaxResult accountLogin(@RequestBody LoginDto loginDto){
        return logininfoService.accountLogin(loginDto);
    }

    @PostMapping("/login/wechat")
    public AjaxResult wechatLogin(@RequestBody Map<String,String> map){
        return logininfoService.wechatLogin(map);
    }

    /**
     * 微信绑定
     * @param map
     * @return
     */
    @PostMapping("/login/wechat/binder")
    public AjaxResult wechatBinder(@RequestBody Map<String,String> map){
        return logininfoService.wechatBinder(map);
    }
}
